
function loadMenuTree(menuTree) {
	$('#menuTree').data('jstree', false).empty()
	$('#menuTree').jstree({
		"plugins" : [ "wholerow", "checkbox" ],
		'core' : {
			'data' : menuTree
		},
		"checkbox" : {
			//"keep_selected_style" : false,
			//"undetermined" : true
			//"three_state" : false,
			//"cascade" : ' up'
		}
	});
	$('#menuTree').jstree('open_all');
}
function getAllSelectNodes() {
	var ref = $('#menuTree').jstree(true); // 获得整个树
	var menuIds = ref.get_selected(); // 获得所有选中节点的，返回值为数组
	$("#menuTree").find(".jstree-undetermined").each(function(i, element) {
		menuIds.push($(element).closest('.jstree-node').attr("id"));
	});
	$("#menuIds").val(menuIds);
}
function getMenuTreeData() {
	var roleId = $('#roleId').val();
	$.ajax({
		type : "POST",
		url : "/sysMenu/getMenusTree?id=" + roleId,
		success : function(data) {
			loadMenuTree(data);
		}
	});
}
